package com.example.android2019.homework.homework4;

import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;

import com.example.android2019.R;

public class RegisterActivity extends AppCompatActivity {
    Button btn_reg_one, btn_reg_two, btn_reg_three, btn_reg_four;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_register);
        inti();
        View.OnClickListener clickListener = new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                switch (v.getId()) {
                    case R.id.btn_reg_one:
                        message();
                        break;
                    case R.id.btn_reg_two:
                        womanGod();
                        break;
                    case R.id.btn_reg_three:
                        BMI();
                        break;
                    case R.id.btn_reg_four:
                        computer();
                        break;
                }
            }
        };
        btn_reg_one.setOnClickListener(clickListener);
        btn_reg_two.setOnClickListener(clickListener);
        btn_reg_three.setOnClickListener(clickListener);
        btn_reg_four.setOnClickListener(clickListener);
        /*跳转*/
        skip();
    }

    private void inti() {
        btn_reg_one = findViewById(R.id.btn_reg_one);
        btn_reg_two = findViewById(R.id.btn_reg_two);
        btn_reg_three = findViewById(R.id.btn_reg_three);
        btn_reg_four = findViewById(R.id.btn_reg_four);
    }

    private void message() {
        Intent intent = new Intent(RegisterActivity.this, Relative1Activity.class);
        intent.putExtra("test", "tz");
        startActivity(intent);
    }

    private void womanGod() {
        Intent intent = new Intent(RegisterActivity.this, BeautyActivity.class);
        intent.putExtra("test", "tz");
        startActivity(intent);
    }

    private void BMI() {
        Intent intent = new Intent(RegisterActivity.this, BMIActivity.class);
        intent.putExtra("test", "tz");
        startActivity(intent);
    }

    private void computer() {

    }

    private void skip() {
        /*获取传递的数据*/
        Intent intent = this.getIntent();
        String a = intent.getStringExtra("test");
        Toast.makeText(this, a, Toast.LENGTH_SHORT).show();
    }
}
